<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">

        <ui:define name="title">
            <h:outputText value="#{bundle.ViewAlunoTitle}"></h:outputText>
        </ui:define>

        <ui:define name="menuLateral">

            <h:form id="formLateralMenuAlunoView">
                <h:panelGroup>
                    <p:slideMenu style="width: 120px" >
                        <p:menuitem value="Alunos" action="#{alunoController.prepareList}"
                                    icon="ui-icon-suitcase" ajax="false" />
                        <p:separator />
                        <p:menuitem value="Novo Aluno" action="#{alunoController.prepareCreate}"
                                    icon="ui-icon-document" />
                        <p:menuitem value="Editar Aluno" action="Edit"
                                    icon="ui-icon-pencil" ajax="false" />
                        <p:menuitem value="Excluir Aluno" actionListener="#{alunoController.destroy}"
                                    icon="ui-icon-trash" ajax="false" />
                        <p:separator />
                        <p:submenu label="Cadastros Necessários" icon="ui-icon-folder-collapsed">
                            <p:submenu label="Localidades" icon="ui-icon-bookmark">
                                <p:menuitem value="#{bundle.ListUfTitle}" action="/paginasEntidades/uf/List" ajax="false" />
                                <p:menuitem value="#{bundle.ListCidadeTitle}" action="/paginasEntidades/cidade/List" ajax="false" />
                                <p:menuitem value="#{bundle.ListTipoEnderecoTitle}" action="/paginasEntidades/tipoEndereco/List" ajax="false" />
                            </p:submenu>
                            <p:submenu label="Contatos" icon="ui-icon-contact">
                                <p:menuitem value="#{bundle.ListOperadoraTitle}"    action="/paginasEntidades/operadora/List" ajax="false" />
                                <p:menuitem value="#{bundle.ListTipoTelefoneTitle}" action="/paginasEntidades/tipoTelefone/List" ajax="false" />
                            </p:submenu>
                        </p:submenu>
                    </p:slideMenu>
                </h:panelGroup>
            </h:form>

        </ui:define>

        <ui:define name="body">

            <h:panelGroup id="messagePanel" layout="block">
                <p:growl />
            </h:panelGroup>

            <h:form id="formAlunoView">
                <p:panelGrid columns="8">
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_nome}" for="nome" />
                    <p:inputText id="nome" value="#{alunoController.selected.nome}" 
                                 title="#{bundle.ViewPessoaTitle_nome}" required="true" 
                                 requiredMessage="#{bundle.ViewPessoaRequiredMessage_nome}" disabled="true" />
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_cgc}" for="cgc" />
                    <p:inputMask id="cgc" value="#{alunoController.selected.cgc}" 
                                 title="#{bundle.ViewPessoaTitle_cgc}" required="true" 
                                 requiredMessage="#{bundle.ViewPessoaRequiredMessage_cgc}" disabled="true"
                                 mask="#{alunoController.maskCgc}" />
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_rg}" for="rg" />
                    <p:inputText id="rg" value="#{alunoController.selected.rg}" 
                                 title="#{bundle.ViewPessoaTitle_rg}" disabled="true" />
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_dataNascimento}" for="dataNascimento" />
                    <p:inputText id="dataNascimento" value="#{alunoController.selected.dataNascimento}" 
                                 title="#{bundle.ViewPessoaTitle_dataNascimento}" disabled="true" >
                        <f:convertDateTime pattern="dd/MM/yyyy" />
                    </p:inputText>
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_EMail}" for="EMail" />
                    <p:inputText id="EMail" value="#{alunoController.selected.EMail}" 
                                 title="#{bundle.ViewPessoaTitle_EMail}" disabled="true" />
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_twitter}" for="twitter" />
                    <p:inputText id="twitter" value="#{alunoController.selected.twitter}" 
                                 title="#{bundle.ViewPessoaTitle_twitter}" disabled="true" />
                    <h:outputLabel value="#{bundle.ViewPessoaLabel_facebook}" for="facebook" />
                    <p:inputText id="facebook" value="#{alunoController.selected.facebook}" 
                                 title="#{bundle.ViewPessoaTitle_facebook}" disabled="true" />
                </p:panelGrid>
                <br/>
                <br/>
            </h:form>

            <h:form id="formAlunoEnderecoList">
                <h:panelGroup id="pgTableEndereco">

                    <p:dataTable id="tableAlunoEndereco" value="#{alunoController.itemsEndereco}"
                                 var="itemEndereco" emptyMessage="#{bundle.ListEnderecoEmpty}" style="border:solid 1px">


                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListEnderecoTitle}"/>
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_tipoEndereco}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.tipoEndereco.descricao}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_descricao}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.descricao}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_numero}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.numero}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_bairro}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.bairro}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_cidade}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.cidade.toString()}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_cep}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.cep}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEnderecoTitle_complemento}"/>
                            </f:facet>
                            <h:outputText value="#{itemEndereco.complemento}"/>
                        </p:column>

                    </p:dataTable>
                    <br/>
                    <br/>

                </h:panelGroup>
            </h:form>

            <h:form id="formAlunoTelefoneList">
                <h:panelGroup id="pgTableTelefone">

                    <p:dataTable id="tableAlunoTelefone" value="#{alunoController.itemsTelefone}"
                                 var="itemTelefone" emptyMessage="#{bundle.ListTelefoneEmpty}" 
                                 style="border:solid 1px">


                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListTelefoneTitle}"/>
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListTelefoneTitle_tipoTelefone}"/>
                            </f:facet>
                            <h:outputText value="#{itemTelefone.tipoTelefone.toString()}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListTelefoneTitle_numero}"/>
                            </f:facet>
                            <h:outputText value="#{itemTelefone.numero}"/>
                        </p:column>
                        
                    </p:dataTable>
                </h:panelGroup>
            </h:form>

        </ui:define>
    </ui:composition>

</html>